package com.example.wacoffee_manage.Mapper;

import com.example.wacoffee_manage.annotation.AutoFill;
import com.example.wacoffee_manage.common.OperationType;
import com.example.wacoffee_manage.pojo.Store;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface storeMapper {

    @Select("select id, name, create_time, update_time from store")
    List<Store> getAll();

    @AutoFill(OperationType.INSERT)
    @Insert("insert into store (name, create_time, update_time) values (#{name},#{createTime},#{updateTime})")
    void add(Store store);

    @Select("select id, name, create_time, update_time from store where id = #{id}")
    Store getById(int id);

    @AutoFill(OperationType.UPDATE)
    @Update("update store set name=#{name},update_time=#{updateTime} where id=#{id}")
    void update(Store store);

    @Delete("delete from store where id=#{id}")
    void delete(int id);
}
